import request from '@/utils/request'
import qs from 'qs'


export function findListByPage(param) {
  return request({
    url: 'api/scriptPublish/task/page',
    method: 'get',
    param
  })
}

export function findById(id) {
  return request({
    url: 'api/scriptPublish/task' + '/' + id,
    method: 'get',
    id
  })
}

export function add(data) {
  return request({
    url: 'api/scriptPublish/task',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/scriptPublish/task/' + ids,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: 'api/scriptPublish/task',
    method: 'put',
    data
  })
}

export function restore(publishTaskId, clusterId) {
  return request({
    url: 'api/scriptPublish/task/restore/' + publishTaskId + '/' + clusterId,
    method: 'post',
    publishTaskId,
    clusterId
  })
}

export default {
  findListByPage,
  findById,
  add,
  del,
  edit,
  restore
}
